Defining Variables
SyncBackSE includes a whole range of variables that can be used in the Source and Destination settings for a profile:
%DATE% Current date, e. g. 24-6-2005
%TIME% Current time in 24 hour clock format, e. g. 19-30
%YEAR% Current year, e. g. 2005
%MONTH% Current month, e. g. 2
%DAY% Current day of the month, e. g. 10
%DAYOFWEEK% Current day of the week, (1 = Monday, 7 = Sunday)
%DAYOFYEAR% Current day of the year (January 1st = 1)
%HOUR% Current hour (24 hour clock format), e. g. 19
%MINUTE% Current minute
%SECOND% Current second
%MILLISECOND% Current millisecond (0 to 999)
%THISDRIVE% The drive that SyncBackSE is running on, e. g. C:
%THISPATH% The path that SyncBackSE is running from, e.g. C:\Program Files\2BrightSparks\SyncBackSE
%LABEL=?% The entry is replaced by the drive with that label (see below)
%SERIAL=?% The entry is replaced by the drive with that serial number (see below)
%WEEKOF% Week of the year (1 to 53). WeekOf uses the ISO 8601 standard to define the week of the year. That is, a week is defined as running from Monday through Sunday, and the first week of the year is defined as the one that includes the first Thursday of the year (the first week that includes four or more days in the year). This means that if the first calendar day of the year is a Friday, Saturday, or Sunday, then for the first three, two, or one days of the calendar year, WeekOf returns the last week of the previous year. Similarly, if the last calendar day of the year is a Monday, Tuesday, or Wednesday, then for the last one, two, or three days of the calendar year, WeekOf returns 1 (the first week of the next calendar year).
%WEEKOFTHEMONTH% Week of the month (1 to 6). WeekOfTheMonth uses the ISO 8601 standard definition of a week. That is, a week is considered to start on a Monday and end on a Sunday.
%WEEKSINYEAR% The number of weeks in the year (52 or 53). WeeksInYear defines the first week of the year according to the ISO 8601 standard. That is, the first week of the year is the one that includes the first Thursday of the year (the first week that has 4 or more days in the year). This means that WeeksInYear always returns either 52 or 53.
%NTHDAYOFWEEK% Note that this value may differ from the value that the WeekOfTheMonth variable returns, because NthDayOfWeek counts every occurrence of the given weekday, while WeekOfTheMonth only counts a week if it includes 4 or more days in the month. Thus, for example, if today is a Saturday and is the first day of a month, NthDayOfWeek returns 1, while WeekOfTheMonth returns 5 (or maybe 4), indicating the last week of the previous month.
%HOUROFTHEYEAR% The number of complete hours between the current date & time and 12:00 AM on Jan 1 of the year.
%HOUROFTHEMONTH% The number of complete hours between the current date & time and 12:00 AM on the first day of the month.
%HOUROFTHEWEEK% The number of complete hours between the current date & time and 12:00 AM on Monday of the week.
%MINUTEOFTHEYEAR% The number of minutes between the current date & time and 12:00:00:00 AM on Jan 1 of the year.
%MINUTEOFTHEMONTH% The number of minutes between the current date & time and
12:00 AM on the first day of the month.
%MINUTEOFTHEWEEK% The number of minutes between the current date & time and 12:00 AM on Monday of the week (the week starts on Monday).
%MINUTEOFTHEDAY% The number of minutes between the current date & time and 12:00 AM on the same day.
%SECONDOFTHEYEAR% The number of seconds between the current date & time and 12:00:00:00 AM on Jan 1 of the year.
%SECONDOFTHEMONTH% The number of seconds between the current date & time and 12:00:00 AM on the first day of the month.
%SECONDOFTHEWEEK% The number of seconds between the current date & time and 12:00:00 AM on Monday of the week (the week starts on Monday).
%SECONDOFTHEDAY% The number of seconds between the current date & time and 12:00:00 AM on the same day.
%SECONDOFTHEHOUR% The number of seconds between the current date & time and the start of the same hour on the same day.
%MILLISECONDOFTHEYEAR% The number of milliseconds between the current date & time and 12:00:00:00 AM on Jan 1 of the year.
%MILLISECONDOFTHEMONTH% The number of milliseconds between the beginning (Midnight on the first day) of the month and the current date & time.
%MILLISECONDOFTHEWEEK% The number of milliseconds between the current date & time and 12:00:00:00 AM on Monday of the current week (the week starts on Monday).
%MILLISECONDOFTHEDAY% The number of milliseconds between the current date & time and the beginning (midnight) on the same day.
%MILLISECONDOFTHEHOUR% The number of milliseconds between the current time and the start of the same hour on the same day.
%MILLISECONDOFTHEMINUTE% The number of milliseconds between the current time and the start of the same minute on the same day.
%DAYSINMONTH% Number of days in current month.
%DAYSINYEAR% Number of days in current year.
These new variables allow you, for example, to keep 7 days worth of backups, e. g. you could set your destination to D:Backup%DAYOFWEEK% so that you'll always have backups of the last seven days worth of files.
%MONTHNAME% The first three letters of the current month, e.g. Jan. Note that English is always used.
%DAYOFWEEKNAME% The first three letters of the day of the week, e.g. Mon. Note that English is always used.
%QUARTEROFYEAR% Returns the current quarter for the current year, i.e. 1 for January to March, 2 for April to June, 3 for July to September, and 4 for October to December.
%THISPROGRAM% The path and filename of the SyncBackSE program itself.
%SBVERSION% The complete version number of the SyncBackSE program itself, e.g. 4.0.8.0
%SYNCBACKFOLDER% The default folder that SyncBackSE stores itÆs profiles in, e.g. C:\Documents and Settings\[username]\Local Settings\Application Data\2BrightSparks\SyncBack\. Note that this is not necessarily where the profiles are stored (you may have configured it to store them in %THISPATH%, for examples)
%SYNCBACKBACKUPFOLDER% The default folder that SyncBackSE stores itÆs profile backup files in, e.g. C:\Documents and Settings\[username]\Local Settings\Application Data\2BrightSparks\SyncBack\ProfileBackup\. Note that this is not necessarily where the backups are stored.
Drives
There are six special variables than can be used to identify drives based on their label or serial number. These are very useful when using external USB drives, for example, which may have a different drive letter each time they are plugged-in:
%LABEL=?% The entry is replaced by the drive with that label. For example, if your C drive is labelled My Disk then %LABEL=My Disk%Documents would be translated into C:\Documents. Note that you can only use one label per string but can use it multiple times. Also, the drives A and B are ignored (use LABELALL to include drives A and B, see below).
%LABELALL=?% This is the same as the LABEL variable except it also includes the drives A and B, which are typically floppy disk drives. When the floppy drive is accessed to get the label of the disk in it may become irritating, which is why you should use LABEL unless you need the label of a disk in drive A or B.
%SERIAL=?% The entry is replaced by the drive with that serial number. For example, if your D drive has a serial number of BC46-F69E then %SERIAL=BC46-F69E%Program Files will be translated at runtime into D:\Program Files. Note that you can only use one serial per string but can use it multiple times. Also, the drives A and B are ignored (use SERIALALL to include drives A and B, see below).
%SERIALALL=?% This is the same as the SERIAL variable except it also includes the drives A and B, which are typically floppy disk drives. When the floppy drive is accessed to get the serial number of the disk in it may become irritating, which is why you should use SERIAL unless you need the label of a disk in drive A or B.
%DISKLABEL% The label of the disk in the drive.
%DISKSERIAL% The unique serial number of the disk in the drive.
Important note about Variable usage
An important point to remember is that Windows has it's own environment variables, e.g. %USERNAME%. When these variables are used in a batch file, or on the command line, then Windows automatically expands them. Unknown variables are simply deleted. For example, if you had the following batch file:
@echo off
"c:\program files\2brightsparks\syncbackse\syncbackse.exe" -source "x:\%DAY%\"
Then when run it would actually be expanded to do the following:
@echo off
"c:\program files\2brightsparks\syncbackse\syncbackse.exe" -source "x:\\"
Note that the %DAY% has been removed because it's an unknown Windows variable (it's a SyncBackSE variable). To stop Windows from changing SyncBackSE variables you must use two percentage signs, e.g.
@echo off
"c:\program files\2brightsparks\syncbackse\syncbackse.exe" -source "x:\%%DAY%%\"
All Content: 2BrightSparks Pte Ltd ⌐ 2003-2006